const Merge = require('webpack-merge');
const CommonConfig = require('./webpack.common.js');
const webpack = require('webpack');

module.exports = Merge(CommonConfig, {

    plugins: [
        //todo：暂时还不知道有什么用
        new webpack.LoaderOptionsPlugin({
            minimize: true,
            debug: true
        }),

        //todo：暂时还不知道有什么用
        new webpack.DefinePlugin({
            'process.env': {
                'NODE_ENV': JSON.stringify('production')
            }
        }),

        //在插件里，默认就会做shaking tree，
        //同时也会进行编码压缩
        new webpack.optimize.UglifyJsPlugin({
            sourceMap: true// https://webpack.js.org/guides/migrating/#uglifyjsplugin-sourcemap
        })

        /*为什么options会报错
         new webpack.optimize.UglifyJsPlugin({
         sourceMap: options.devtool && (options.devtool.indexOf("sourcemap") >= 0 || options.devtool.indexOf("source-map") >= 0)
         })
         */
    ]
})